# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=perl-cryptx
_pkgname=CryptX
pkgver=0.072
pkgrel=5
pkgdesc='Cryptographically secure random number generator.'
arch=('x86_64' 'aarch64')
license=('PerlArtistic' 'GPL')
options=('!emptydirs')
depends=('perl')
url='https://metacpan.org/pod/Crypt::PRNG'
source=("http://search.cpan.org/CPAN/authors/id/M/MI/MIK/$_pkgname-$pkgver.tar.gz")
sha512sums=('9e51181b14c08f8c0769089f8c9a5feefa7c4f1a8dff2501cf1d1d475ae162f8df35c7cceff9d1742552951e13450cac9d70eb1ead8178e0c95cd1abfea5e03c')

# Function to change to the working directory and set
# environment variables to override undesired options.
_enviro() {
  cd "$_pkgname-$pkgver"

  export \
    PERL_MM_USE_DEFAULT=1 \
    PERL_AUTOINSTALL=--skipdeps \
    PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'" \
    PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \
    MODULEBUILDRC=/dev/null
}

build() {
  _enviro

  /usr/bin/perl Makefile.PL

  make
}

package() {
  _enviro

  make install

  find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}

